export default (url, method, params) => {
	let token = uni.getStorageSync('token');
	// let Link = 'http://192.168.1.250:8080/jeecg-boot'
	let Link = 'https://api.wdjlm.cn/jeecg-boot'
	getApp().globalData.url = Link
	return new Promise((resolve, reject) => {
		uni.request({
			url: Link + url,
			method: method,
			header: {
				'X-Access-Token': token,
			},
			data: {
				...params
			},
			success(res) {
				resolve(res.data);
				if (res.data.message == 'Token失效，请重新登录!') {
					uni.showToast({
						title: '登录已过期',
						icon: "none",
						mask: true
					})
					// setTimeout(() => {
					// 	uni.clearStorageSync();
					// 	uni.navigateTo({
					// 		url: '/pages/login'
					// 	})
					// }, 1000)
				}
			},
			fail(err) {
				reject(err);
				console.log(err);
			},
			complete() {}
		});
	});
};